package com.liu.auto.interceptor;

import com.liu.auto.token.TokenTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    TokenInterceptor tokenInterceptor;

    @Autowired
    ValidationProperties properties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns(properties.getPathPatterns())//拦截的路径
                .excludePathPatterns(properties.getExcludePathPatterns());//不拦截的路径
    }
}
